﻿<%@ Page Language="C#" MasterPageFile="~/Template/List3.master" AutoEventWireup="true"
    CodeFile="ApplyDetail.aspx.cs" Inherits="Gift_ApplyDetail" Title="Untitled Page"
    EnableEventValidation="false" %>

<%@ Register Src="~/Control/ListHeader.ascx" TagName="ListHeader" TagPrefix="wsc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>

    <style type="text/css">
        .style2 { width: 214px; }
        .style3 { height: 32px; }
        #tb1 tr td { padding: 5px; }
        .btn { border: #2C59AA 1px solid; padding-right: 2px; padding-left: 2px; font-size: 12px; cursor: hand; color: black; padding-top: 2px; }
        LABEL { color: #15428b; }
        .TitleBar .Normal { color: Blue; vertical-align: top; float: right; margin: 1px; }
        .TitleBar .Over { color: Blue; vertical-align: top; float: right; border: 1px solid #99BBE8; background: #baddf8; }
        .TitleBar span { white-space: nowrap; color: #15428B; line-height: 16px; padding: 2px 4px; vertical-align: middle; }
        .TitleBar span img { margin: 2px 0; vertical-align: text-bottom; }
    </style>

    <script>
        function getID(id) {
            document.getElementById('<%=tbSelectedID.ClientID %>').value = id;
        }

        function SwitchDefaultTableRow() {
            if (document.getElementById("ctl00_tbLayout").value != "Simple") {
                var s = document.getElementById('<%=tbSelectedID.ClientID %>').value;
                if (s != '' && document.getElementById(s) != null) {
                    document.getElementById(s).click();
                }
                else if (document.getElementById("TableRow_0") != null) {
                    document.getElementById("TableRow_0").click();
                }
            }
        }


        function clearText(control, text) {
            if (control.value == text)
                control.innerText = "";
        }
        function insertText(control, text) {
            if (control.value == "")
                control.innerText = text;
        }

        function refreshParent() {
            try {
                window.opener.document.getElementById('ctl00_ListToolBarPlaceHolder_btnRefresh').click();
            }
            catch (e) {
            }
        }

        function countChar() {
            document.getElementById('counter').innerHTML = 200 - document.getElementById('ctl00_ListToolBarPlaceHolder_status').value.length;
            if (document.getElementById('counter').innerHTML < 0) {
                document.getElementById('counter').style.color = "red";
            }
            else
                document.getElementById('counter').style.color = "gray";

            var counter2 = document.getElementById('counter2');
            if (counter2 != null) {
                counter2.innerHTML = 200 - document.getElementById('ctl00_ListToolBarPlaceHolder_tbShyj').value.length;
                if (counter2.innerHTML < 0) {
                    counter2.style.color = "red";
                }
                else
                    counter2.style.color = "gray";
            }
        }


        function OnlyNum(obj) {
            obj.value = obj.value.replace(/[^0-9]/ig, "");
        }

        function SetPrice(obj) {
            var pricelist = '<%=PriceList %>';
            var obj2 = document.getElementById('<%=tbGiftPrice.ClientID %>');
            var obj3 = document.getElementById('<%=ddlUnit.ClientID %>');

            if (obj.selectedIndex == 0) {
                obj2.value = '';
                obj3.selectedIndex = 0;
                return;
            }

            if (pricelist != '') {
                for (var i = 0; i < pricelist.split(';').length; i++) {
                    if (obj.options[obj.selectedIndex].value == pricelist.split(';')[i].split('|')[0]) {
                        obj2.value = pricelist.split(';')[i].split('|')[1];
                        for (var l = 0; l < obj3.options.length; l++) {
                            if (obj3.options[l].value == pricelist.split(';')[i].split('|')[2])
                                obj3.selectedIndex = l;

                        }
                    }
                }
            }
        }

        window.onload = countChar;

        function selectAuditor() {
            window.showModalDialog("Function.Web/UserChooser.aspx?SelectType=User&nocache=" + Math.random() * 10000 + "&ReturnValueFormat=" + encodeURI("<%=tbAuditorDisplay.ClientID %>:DisplayName|<%=tbAuditorID.ClientID %>:ID|<%=tbAuditorName.ClientID %>:Name"), document, "dialogWidth:800px;dialogHeight:600px;status:yes;resizable:no");
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitlePlaceHolder" runat="Server">
    <table cellspacing="2" cellpadding="0" border="0">
        <tr>
            <td class="ToolMenuEdit" runat="server" id="tdApply">
                <div class="Normal" oldclass="Normal" onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)">
                    <asp:LinkButton runat="server" ID="btnSupply" OnClick="btnSupply_Click">
                        <span>
                            <img src="<%=ResolveUrl("~/Images/Icon/Object/Dataset-add.gif")%>" alt="申领" /></span><span>申领</span></asp:LinkButton>
                    <asp:LinkButton runat="server" ID="btnSave" OnClick="btnSupply_Click" Visible="false">
                        <span>
                            <img src="<%=ResolveUrl("~/Images/Icon/Object/tz-add.gif") %>" alt="保存" /></span><span>保存</span></asp:LinkButton>
                </div>
            </td>
            <td class="Fg" runat="server" id="tdFg1">
                <img src="<%=ResolveUrl("~/Images/FgLine.gif") %>" alt="" />
            </td>
            <td class="ToolMenuEdit" runat="server" id="tdClose">
                <div class="Normal" oldclass="Normal" onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)"
                    onclick="window.close();">
                    <span>
                        <img src="<%=ResolveUrl("~/Images/Icon/Action/delete.gif") %>" alt="关闭" /></span>
                    <span>关闭</span>
                </div>
            </td>
            <td class="Fg" runat="server" id="tdFg2" visible="false">
                <img src="<%=ResolveUrl("~/Images/FgLine.gif") %>" alt="" />
            </td>
            <td id="tdArrival" runat="server" class="ToolMenu" width="60" visible="false">
                <div class="Normal" oldclass="Normal" onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)">
                    <asp:LinkButton runat="server" ID="lbtnArrival" OnClick="Arrival_Click" CausesValidation="false"
                        OnClientClick="return confirm('确认发货？');">
                    <span>
                        <img src="<%=ResolveUrl("~/Images/已到货.png")%>" alt="发货" /></span><span>发货</span></asp:LinkButton>
                </div>
            </td>
            <td class="ToolMenuEdit" runat="server" id="tdCancel" visible="false">
                <div class="Normal" oldclass="Normal" onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)">
                    <asp:LinkButton runat="server" ID="lbtnCancel" OnClick="lbtnCancel_Click" OnClientClick="return confirm('是否取消申领！')">
                        <span>
                            <img src="<%=ResolveUrl("~/Images/Icon/Action/delete.gif") %>" alt="取消" /></span><span>取消</span></asp:LinkButton>
                </div>
            </td>
            <td>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ListToolBarPlaceHolder" runat="Server">
    <div style="display: none">
        <asp:Button ID="Button1" runat="server" OnClick="btnRefresh_Click" />
        <asp:TextBox ID="TextBox1" runat="server">
        </asp:TextBox>
    </div>
    <div style="display: none">
        <asp:Button ID="btnRefresh" runat="server" OnClick="btnRefresh_Click" />
        <asp:TextBox ID="tbSelectedID" runat="server">
        </asp:TextBox>
    </div>
    <table id="tb1" style="width: 100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="TitleBar" colspan="4" style="padding: 0px; width: 100%">
                <div class="MainTitle">
                    申领基本信息</div>
            </td>
        </tr>
        <tr>
            <td width="10%" style="color: #15428b;">
                申领科室
            </td>
            <td width="40%">
                <span class="TextBoxReadOnly" style="width: 200px;">
                    <asp:Literal ID="ltDepart" runat="server"></asp:Literal></span>
            </td>
            <td width="10%" style="color: #15428b;">
                申领人
            </td>
            <td width="40%">
                <span class="TextBoxReadOnly" style="width: 200px;">
                    <asp:Literal ID="ltApplicant" runat="server"></asp:Literal></span>
            </td>
        </tr>
        <tr>
            <td style="color: #15428b;">
                礼品总价
            </td>
            <td>
                <input type="text" runat="server" id="tbApplyCost" readonly="readonly" class="TextBoxReadOnly"
                    style="width: 200px;" />
            </td>
            <td style="color: #15428b;">
                申领时间
            </td>
            <td>
                <span class="TextBoxReadOnly" style="width: 200px;">
                    <asp:Literal ID="ltTime" runat="server"></asp:Literal></span>
            </td>
        </tr>
        <tr>
            <td style="color: #15428b;">
                申领原因
            </td>
            <td>
                <asp:TextBox ID="tbTitle" MaxLength="20" runat="server" CssClass="TextBoxWrite" Style="width: 200px;">
                </asp:TextBox><span class="Alter">*</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Display="Dynamic"
                    ControlToValidate="tbTitle">必填</asp:RequiredFieldValidator>
            </td>
            <td style="color: #15428b;">
                拟领取时间
            </td>
            <td>
                <asp:TextBox ID="tbNilinqu" MaxLength="20" runat="server" CssClass="TextBoxWrite">
                </asp:TextBox><span class="Alter">*</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic"
                    ControlToValidate="tbNilinqu">必填</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="color: #15428b;">
                审核状态
            </td>
            <td>
                <asp:DropDownList runat="server" ID="ddlStatus" CssClass="TextBoxWrite">
                    <asp:ListItem Value="">请选择</asp:ListItem>
                    <asp:ListItem Text="即时审核" Value="即时审核"></asp:ListItem>
                    <asp:ListItem Text="延后审核" Value="延后审核"></asp:ListItem>
                </asp:DropDownList>
                <span class="Alter">*</span>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                    ControlToValidate="ddlStatus">必填</asp:RequiredFieldValidator>
            </td>
            <td style="color: #15428b;">
                审核人
            </td>
            <td>
                <asp:DropDownList runat="server" ID="ddlAuditor" CssClass="TextBoxWrite">
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                    ControlToValidate="ddlAuditor">必填</asp:RequiredFieldValidator>
                <div style="display: none;">
                    <asp:TextBox ID="tbAuditorDisplay" MaxLength="20" runat="server" CssClass="TextBoxReadOnly"
                        onfocus="selectAuditor()" Style="width: 200px;"></asp:TextBox>
                    <input type="text" runat="server" id="tbAuditorID" /><input type="text" runat="server"
                        id="tbAuditorName" />
                </div>
            </td>
        </tr>
        <tr>
            <td style="color: #15428b;">
                备注
            </td>
            <td colspan="3">
                <textarea id="status" runat="server" class="TextBoxWrite" name="status" rows="2"
                    style="width: 300px;"></textarea>还可以输入<span id="counter" style="color: #FF0000">200</span>字
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic"
                    ErrorMessage="请控制在200个字以内" ControlToValidate="status" ValidationExpression=".{1,200}">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr runat="server" id="trShyj" visible="false">
            <td style="color: #15428b;">
                审核意见
            </td>
            <td colspan="3">
                <textarea id="tbShyj" runat="server" class="TextArea01" name="tbShyj" rows="2" style="width: 300px;"></textarea>还可以输入<span
                    id="counter2" style="color: #FF0000">200</span>字
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic"
                    ErrorMessage="请控制在200个字以内" ControlToValidate="status" ValidationExpression=".{1,200}">
                </asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td class="TitleBar" colspan="4" style="padding: 0px; width: 100%; position: relative;">
                <div class="MainTitle">
                    申领礼品</div>
                <div class="Normal" oldclass="Normal" onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)">
                    <asp:LinkButton runat="server" ID="btnAddRow" OnClick="btnAddRow_Click">
                        <span >
                            <img src="<%=ResolveUrl("~/Images/add.png")%>" alt="申领" /></span><span>添加到申领列表</span></asp:LinkButton>
                </div>
            </td>
        </tr>
        <tr>
            <td width="15%" style="color: #15428b" style="padding: 5px">
                礼品名称
            </td>
            <td style="padding: 5px; width: 135px">
                <asp:TextBox ID="tbGiftName" runat="server" CssClass="TextBoxWrite" Style="float: left;
                    display: none;">
                </asp:TextBox>
                <asp:DropDownList ID="ddlGiftName" runat="server" Style="float: left;" Width="137px"
                    onchange="SetPrice(this);">
                </asp:DropDownList>
            </td>
            <td width="80" style="color: #15428b; padding: 5px">
                礼品单价
            </td>
            <td style="padding: 5px">
                <input type="text" runat="server" id="tbGiftPrice" readonly="readonly" class="TextBoxWrite" />
            </td>
        </tr>
        <tr>
        </tr>
        <tr>
            <td width="80" style="color: #15428b; padding: 5px">
                礼品数量
            </td>
            <td colspan="3" style="padding: 5px">
                <asp:TextBox ID="tbGiftCount" runat="server" CssClass="TextBoxWrite">
                </asp:TextBox>
                <asp:DropDownList runat="server" ID="ddlUnit" CssClass="TextBoxWrite" Enabled="false">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td width="80" style="color: #15428b; padding: 5px">
                备注
            </td>
            <td colspan="3" style="padding: 5px">
                <asp:TextBox Rows="3" Style="width: 480px;" ID="txtGiftRemark" MaxLength="200" runat="server"
                    CssClass="TextBoxWrite">
                </asp:TextBox>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="AdvancedSearchPlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="ListHeaderPlaceHolder" runat="Server">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="TitleBar" colspan="4" style="padding: 0px; width: 100%; position: relative;">
                <div class="MainTitle">
                    申领礼品列表</div>
            </td>
        </tr>
    </table>
    <table cellspacing="0" cellpadding="0" border="0" class="PageGridHeader" width="100%">
        <wsc:ListHeader ID="lhName" runat="server" Title="&nbsp;礼品名称" Align="center" />
        <wsc:ListHeader ID="lhPrice" runat="server" Title="&nbsp;礼品单价" Width="80" Align="center" />
        <wsc:ListHeader ID="lhCount" runat="server" Title="&nbsp;礼品数量" Width="80" Align="center" />
        <wsc:ListHeader ID="lhTotal" runat="server" Title="&nbsp;礼品总价" Width="80" Align="center" />
        <wsc:ListHeader ID="lhRemark" runat="server" Title="&nbsp;备注" Width="200" Align="center" />
        <wsc:ListHeader ID="lhDelete" runat="server" Title="&nbsp;删除" Width="40" Align="center" />
    </table>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="ListContentPlaceHolder" runat="Server">
    <table id="Table1" width="100%" border="0" cellspacing="0" cellpadding="0" class="MainInfolist">
        <asp:Repeater ID="rptProduct" runat="server" OnItemCommand="rptProduct_ItemCommand">
            <ItemTemplate>
                <tr id="TableRow_<%# Container.ItemIndex%>" style="cursor: hand" class="Normal" oldclass="Normal"
                    onmouseover="OverChangeClass(this);" onmouseout="ReturnClass(this)" onclick="ClickChangeClass(this);">
                    <td align="left">
                        <%# DataBinder.Eval(Container.DataItem, "GiftName") %>
                    </td>
                    <td width="80" align="center">
                        <%# DataBinder.Eval(Container.DataItem, "GiftPrice")%>
                    </td>
                    <td width="80" align="center">
                        <%# DataBinder.Eval(Container.DataItem, "GiftCount")%>
                    </td>
                    <td width="80" align="center">
                        <%# DataBinder.Eval(Container.DataItem, "GiftTotal","{0:N}")%>
                    </td>
                    <td width="200" align="left">
                        <span title="<%# DataBinder.Eval(Container.DataItem, "Remark")%>">
                            <%# WebCommon.Cut(DataBinder.Eval(Container.DataItem, "Remark"),15)%></span>
                    </td>
                    <td width="40" align="center">
                        <asp:ImageButton runat="server" ID="ibtnbtnDelete" ImageUrl="~/Images/Icon/Action/delete.gif"
                            CommandName="Delete" CausesValidation="false" />
                    </td>
                </tr>
            </ItemTemplate>
        </asp:Repeater>
    </table>
</asp:Content>
